package games.eightPuzzle;

import java.util.ArrayList;

import games.eightPuzzle.states.SlidingPuzzleState;


/**
 * @author avishl02
 * this class represents the information of a solution
 */
public class SolutionInfo implements Comparable<SolutionInfo>{
	
	private ArrayList<SlidingPuzzleState> _solTrace;
	private long _nodesExpantionNumber;
	private long _time;
	private boolean _reversed;
	
	//ctor
	public SolutionInfo(ArrayList<SlidingPuzzleState> solTrace,long expandtion,long time,boolean reversed){
		_nodesExpantionNumber = expandtion;
		_solTrace = solTrace;
		_time = time;
		_reversed = reversed;
	}
	
	//return the number of nodes who has been expanded in addition
	//to get to this solution
	public long getNodesExpantionNumber() {
		return _nodesExpantionNumber;
	}
	
	//get the length of the solution
	public int getSolutionLength() {
		return _solTrace.size();
	}
	//get the trace from the start to this solution
	public ArrayList<SlidingPuzzleState> getSolutionTrace() {
		return _solTrace;
	}
	
	public boolean hasSolution(){
		return _solTrace!=null;
	}
	
	public long getTime(){
		return _time;
	}

	public boolean isReversed(){
		return _reversed;
	}

	@Override
	public int compareTo(SolutionInfo o) {
		return new Integer(_solTrace.size()).compareTo(o.getSolutionLength());
	}

}
